package com.qf.controller;

import com.qf.pojo.Goods;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

/**
 * @author YDW
 * projectName:project2202_4
 * time:2022/6/13 11:00
 * description:
 */
@RestController
@RequestMapping("/goods")
public class HelloController {
    @Value("${server.port}")
    private int port;
    @RequestMapping("/sayHello")
    public String sayHellow(){
        return "Goods Hello!!!---"+port;
    }

    @GetMapping("/get")
    public String get(Integer id){
//        System.out.println("id:"+id);
        System.out.println(1/id);
        return "goods--id:"+Math.random();

    }
    @PostMapping("/add")
    public String add(@RequestBody Goods goods){

        System.out.println(goods);
        System.out.println(1/0);
        return "success";

    }
}
